let moment = require("moment");
let Utils = function () {
    return {};
};

Utils.getCurTimestamp = function () {
    return Math.round((new Date()).getTime() / 1000);
};

Utils.getCurTimestampString = function (format) {
    return toMoment(Utils.getCurTimestamp()).format("YYYY-MM-DD HH:mm:ss");
};

Utils.getTimestampString = function (timeStamp) {
    return toMoment(timeStamp).format("YYYY-MM-DD HH:mm:ss");
};

Utils.toDateString = function (timeStamp) {
    return toMoment(timeStamp).format("YYYY-MM-DD");
};

Utils.timeString = function (timeStamp) {
    return toMoment(timeStamp).format("HH:mm:ss");
};

function toMoment(timeStamp) {
    return moment(timeStamp * 1000);
}
module.exports = Utils;